import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        boolean isFlag = true;
        String details="";
        int balance=10000;//初始金额
        while(isFlag) {
            System.out.println("\n-----------------谷粒记账软件-----------------");
            System.out.println("                   1 收支明细");
            System.out.println("                   2 登记收入");
            System.out.println("                   3 登记支出");
            System.out.println("                   4 退    出\n");
            System.out.print("                   请选择(1-4)：");
            char input=Utility.readMenuSelection();
            switch (input){
                case '1':System.out.println("-----------------当前收支明细记录-----------------");
                System.out.println("收支\t\t总额\t\t收支\t\t描\t述");
                                    System.out.println(details);
                            break;
                case '2':   System.out.print("本次收入金额：");
                            int amount1 = Utility.readNumber();
                            System.out.print("本次收入说明：");
                            String desc=Utility.readString();
                            balance+=amount1;
                            details+="收入\t\t"+balance+"\t\t"+amount1+"\t\t\t"+desc+"\n";
                            break;
                case '3':
                    System.out.print("本次支出金额：");
                    int amount2 = Utility.readNumber();
                    System.out.print("本次支出说明：");
                    String des2=Utility.readString();
                    balance-=amount2;
                    details+="支出\t\t"+balance+"\t\t"+amount2+"\t\t\t"+des2+"\n";
                            break;
                case '4': System.out.println("Y/N");
                    char input2=Utility.readConfirmSelection();
                    if(input2=='Y'){
                        isFlag=false;
                    }
            }
        }
    }
}